package com;

import com.Utils.ThreadUtils;

/**
 * TestJoin
 *
 * @author byc
 * @date 2022-04-22
 */
public class TestJoin {

    public static void main(String[] args) {

        Thread t1 = new Thread(() -> {
            ThreadUtils.sleep(1000);
            System.out.println("t1------");
        });

        Thread t2 = new Thread(() -> {
            ThreadUtils.sleep(2000);
            System.out.println("t2------");
        });

        t1.start();
        t2.start();

        //线程实例调用join方法会阻塞 主线程
        try {
            t1.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("main");

    }

}
